home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / hdf / unix / examples.lha / examples / sds / speed / speedtestF.f < prev   
Encoding:
Text File  |  1991-10-18  |  1.9 KB  |  69 lines

  1.  
  2. C************************************************************
  3. C
  4. C Test program: tests speed writing float data in three ways:
  5. C
  6. C                  1. to HDF SDS, default conversion
  7. C                  2. to HDF SDS, no conversion
  8. C                  3. to raw file, no conversion
  9. C
  10. C Note: in DFSDsettype routine, parameter #3 (DFNTF_CRAY), should
  11. C       be replaced when using other machines.  Currently, the
  12. C       only allowable replacement is 0. (July 1990)
  13. C
  14. C
  15. C Input files:  None.  The data is generated by the program.
  16. C Output files: Three files, named by the user on the command line.
  17. C
  18. C*********************************************************** */
  19.  
  20.  
  21.       program speedtst
  22.  
  23.       integer dssdims, dspdata, dsstype
  24.       integer ret, i, j, x, y
  25.       integer rank, dimsizes(2)
  26.       integer DFNTF_CRAY, DFNT_FLOAT, DFO_FORTRAN
  27.       real    data(1000,1000)
  28.       integer time, tloc1, tloc2
  29.  
  30.       data DFNTF_CRAY/3/, DFNT_FLOAT/5/, DFO_FORTRAN/1/
  31.  
  32.       x = 1000
  33.       y = 1000
  34.  
  35.       rank = 2
  36.       dimsizes(1) = x
  37.       dimsizes(2) = y
  38.  
  39.       do 110 i = 1, x
  40.         do 100 j = 1, y
  41.           data(i,j) = 10.0
  42.   100   continue
  43.   110 continue
  44.  
  45. C Write out scientific data set -- default conversion
  46.       tloc1 = time(0)
  47.       ret = dssdims(rank, dimsizes)
  48.       ret = dspdata('fa',rank, dimsizes, data)
  49.       tloc2 = time(0)
  50.       print *,  'Default conversion:    ', tloc2-tloc1
  51.  
  52. C Write out scientific data set -- no conversions
  53.       tloc1 = time(0)
  54.       ret = dssdims(rank, dimsizes)
  55.       ret = dsstype(DFNT_FLOAT, 0, DFNTF_CRAY,  DFO_FORTRAN)
  56.       ret = dspdata('fb',rank, dimsizes, data)
  57.       tloc2 = time(0)
  58.       print *,  'No conversion:         ', tloc2-tloc1
  59.  
  60. C Write out raw data to a file
  61.       tloc1 = time(0)
  62.       open(unit=10, file='fc', form='UNFORMATTED')
  63.       write(10)  data
  64.       tloc2 = time(0)
  65.       print *,  'Write raw binary:      ', tloc2-tloc1
  66.  
  67.       end
  68.  
  69.